/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interface;

import Biz.StaffBO;
import Biz.TestBO;
import Entity.Staff;
import Entity.Test;
import java.awt.event.KeyEvent;
import java.sql.SQLException;
import java.sql.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author cgzf
 */
public class Panel_ViewStaff extends javax.swing.JPanel {
    
    public final String[] columnNames = {"StaffID", "Name", "Gender", "DOJ", "username", "Status"};
    Model_Staff ms = new Model_Staff();

    /**
     * Creates new form Panel_ViewTest
     */
    public Panel_ViewStaff() throws SQLException {
        initComponents();
        
        tblStaffView.setModel(new Model_Staff(columnNames, new StaffBO().getPStaff()));
        tblStaffView.getColumnModel().getColumn(0).setPreferredWidth(20);
        tblStaffView.getColumnModel().getColumn(1).setPreferredWidth(90);
        tblStaffView.getColumnModel().getColumn(2).setPreferredWidth(27);
        tblStaffView.getColumnModel().getColumn(3).setPreferredWidth(150);
        tblStaffView.getColumnModel().getColumn(4).setPreferredWidth(150);
        tblStaffView.getColumnModel().getColumn(5).setPreferredWidth(27);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btgGender = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblStaffView = new javax.swing.JTable();
        pnlProfile = new javax.swing.JPanel();
        lblTextName = new javax.swing.JLabel();
        lblCost = new javax.swing.JLabel();
        txtFName = new javax.swing.JTextField();
        txtDOJ = new javax.swing.JTextField();
        btnAdd = new javax.swing.JButton();
        btnEdit = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        lblTextName1 = new javax.swing.JLabel();
        txtLName = new javax.swing.JTextField();
        lblCost1 = new javax.swing.JLabel();
        txtDept = new javax.swing.JTextField();
        lblCost2 = new javax.swing.JLabel();
        txtAddress = new javax.swing.JTextField();
        lblCost3 = new javax.swing.JLabel();
        txtPhoneNo = new javax.swing.JTextField();
        lblCost4 = new javax.swing.JLabel();
        lblCost5 = new javax.swing.JLabel();
        lblCost6 = new javax.swing.JLabel();
        txtDOB = new javax.swing.JTextField();
        txtEdu = new javax.swing.JTextField();
        btnMale = new javax.swing.JRadioButton();
        btnFemale = new javax.swing.JRadioButton();
        lblCost7 = new javax.swing.JLabel();
        txtTechSkill = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        cbStatus = new javax.swing.JCheckBox();
        pnlSearch = new javax.swing.JPanel();
        txtSearch = new javax.swing.JTextField();
        lblSearch = new javax.swing.JLabel();

        setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        tblStaffView.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblStaffView.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblStaffViewMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblStaffView);

        pnlProfile.setBorder(javax.swing.BorderFactory.createTitledBorder("Profile"));

        lblTextName.setText("FName");

        lblCost.setText("DateOfJoin");

        txtFName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtFNameActionPerformed(evt);
            }
        });

        btnAdd.setText("Add");
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });

        btnEdit.setText("Edit");
        btnEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditActionPerformed(evt);
            }
        });

        btnDelete.setText("Delete");
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });

        lblTextName1.setText("LName");

        txtLName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtLNameActionPerformed(evt);
            }
        });

        lblCost1.setText("Department");

        lblCost2.setText("Address");

        lblCost3.setText("Phone");

        lblCost4.setText("Gender");

        lblCost5.setText("Birth");

        lblCost6.setText("Education");

        btgGender.add(btnMale);
        btnMale.setText("Male");

        btgGender.add(btnFemale);
        btnFemale.setText("Female");

        lblCost7.setText("TechSkill");

        jLabel1.setText("Status");

        javax.swing.GroupLayout pnlProfileLayout = new javax.swing.GroupLayout(pnlProfile);
        pnlProfile.setLayout(pnlProfileLayout);
        pnlProfileLayout.setHorizontalGroup(
            pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlProfileLayout.createSequentialGroup()
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlProfileLayout.createSequentialGroup()
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblCost)
                            .addComponent(lblTextName)
                            .addComponent(lblTextName1)
                            .addComponent(lblCost1)
                            .addComponent(lblCost2)
                            .addComponent(lblCost3)
                            .addComponent(lblCost4)
                            .addComponent(lblCost5)
                            .addComponent(lblCost6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtDOJ, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                            .addComponent(txtLName)
                            .addComponent(txtFName)
                            .addComponent(txtDept)
                            .addComponent(txtAddress)
                            .addComponent(txtPhoneNo)
                            .addComponent(txtDOB)
                            .addGroup(pnlProfileLayout.createSequentialGroup()
                                .addComponent(btnMale)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnFemale))
                            .addComponent(txtEdu)))
                    .addGroup(pnlProfileLayout.createSequentialGroup()
                        .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDelete))
                    .addGroup(pnlProfileLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addComponent(lblCost7))
                        .addGap(18, 18, 18)
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtTechSkill, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbStatus))))
                .addContainerGap(41, Short.MAX_VALUE))
        );
        pnlProfileLayout.setVerticalGroup(
            pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlProfileLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTextName)
                    .addComponent(txtFName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtLName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTextName1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDOJ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCost))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCost1)
                    .addComponent(txtDept, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCost2)
                    .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCost3)
                    .addComponent(txtPhoneNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCost4)
                    .addComponent(btnMale)
                    .addComponent(btnFemale))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCost5)
                    .addComponent(txtDOB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlProfileLayout.createSequentialGroup()
                        .addComponent(lblCost6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblCost7)
                            .addComponent(txtTechSkill, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(cbStatus))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnAdd)
                            .addComponent(btnEdit)
                            .addComponent(btnDelete)))
                    .addGroup(pnlProfileLayout.createSequentialGroup()
                        .addComponent(txtEdu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        txtSearch.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtSearchKeyPressed(evt);
            }
        });

        lblSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Search.jpg"))); // NOI18N
        lblSearch.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblSearchMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout pnlSearchLayout = new javax.swing.GroupLayout(pnlSearch);
        pnlSearch.setLayout(pnlSearchLayout);
        pnlSearchLayout.setHorizontalGroup(
            pnlSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSearchLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlSearchLayout.setVerticalGroup(
            pnlSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSearchLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblSearch, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pnlSearchLayout.createSequentialGroup()
                        .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 579, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(pnlSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(46, 46, 46)))
                .addComponent(pnlProfile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pnlProfile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(pnlSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 367, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(16, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void txtFNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtFNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtFNameActionPerformed
    
    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
        
        String s = "True";
        if (btnFemale.isSelected()) {
            s = "False";
        }
        JOptionPane.showMessageDialog(this, s);
        //FName, LName, DOJ, Dept, Address, P_No, Gender, DOB, Edu_qual, Tech_Skills, Username, Password, Status
        //   ms.add(txtFName.getText(),txtLName.getText(),txtDOJ.getText(),txtDept.getText(),txtAddress.getText(),Integer.parseInt(txtPhoneNo.getText()),s,txtDOB.getText(),txtEdu.getText(),txtTechSkill.getText());
        //          tblStaffView.setModel(new Model_Staff(columnNames, new StaffBO().getPStaff()));

        
        
    }//GEN-LAST:event_btnAddActionPerformed
    
    private void btnEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditActionPerformed
        try {
            //StaffID, FName, LName, DOJ, Dept, Address, P_No, Gender, DOB, Edu_qual, Tech_Skills, Username, Password, Status
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/mm/dd");            
            String s, g;
            if (cbStatus.isSelected()) {
                s = "true";
            } else {
                s = "false";
            }
            if (btnMale.isSelected()) {
                g = "true";
            } else {
                g = "false";
            }
            //JOptionPane.showMessageDialog(this, Integer.parseInt(tblStaffView.getValueAt(tblStaffView.getSelectedRow(), 0).toString()));
            ms.edit(Integer.parseInt(tblStaffView.getValueAt(tblStaffView.getSelectedRow(), 0).toString()), txtFName.getText(), txtLName.getText(), dateFormat.parse(txtDOJ.getText()), txtDept.getText(), txtAddress.getText(), Integer.parseInt(txtPhoneNo.getText()), Boolean.parseBoolean(g), dateFormat.parse(txtDOB.getText()), txtEdu.getText(), txtTechSkill.getText(), Boolean.parseBoolean(s));
            tblStaffView.setModel(new Model_Staff(columnNames, new StaffBO().getPStaff()));
        } catch (ParseException ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_btnEditActionPerformed
    
    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
    }//GEN-LAST:event_btnDeleteActionPerformed
    
    private void txtLNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtLNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtLNameActionPerformed
    
    private void tblStaffViewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblStaffViewMouseClicked
        try {            
            for (Object o : new StaffBO().searchById(Integer.parseInt(tblStaffView.getValueAt(tblStaffView.getSelectedRow(), 0).toString()))) {
                Staff s = (Staff) o;
                txtDept.setText(s.getDept());
                txtAddress.setText(s.getAddress());
                txtDOB.setText(s.getDOB().toString());
                txtEdu.setText(s.getEdu_qual());
                txtLName.setText(s.getLName());
                txtPhoneNo.setText(String.valueOf(s.getPhoneNo()));
                txtTechSkill.setText(s.getTech_skills());
                txtFName.setText(s.getFName());
                if (s.isGender() == true) {
                    btnMale.setSelected(true);
                } else {
                    btnFemale.setSelected(true);
                }
                if (s.isStatus() == true) {
                    cbStatus.setSelected(true);
                } else {
                    cbStatus.setSelected(false);
                }
            }
            txtDOJ.setText(tblStaffView.getValueAt(tblStaffView.getSelectedRow(), 3).toString());
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Panel_ViewStaff.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        
    }//GEN-LAST:event_tblStaffViewMouseClicked
    
    private void txtSearchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSearchKeyPressed
        int key = evt.getKeyCode();
        if (key == KeyEvent.VK_ENTER) {
            try {
                tblStaffView.setModel(new Model_Staff(columnNames, new StaffBO().searchById(Integer.parseInt(txtSearch.getText()))));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Panel_ViewTest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Panel_ViewTest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
    }//GEN-LAST:event_txtSearchKeyPressed
    
    private void lblSearchMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblSearchMouseClicked
        try {
            tblStaffView.setModel(new Model_Staff(columnNames, new StaffBO().searchById(Integer.parseInt(txtSearch.getText()))));
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Panel_ViewTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Panel_ViewTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_lblSearchMouseClicked
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup btgGender;
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnEdit;
    private javax.swing.JRadioButton btnFemale;
    private javax.swing.JRadioButton btnMale;
    private javax.swing.JCheckBox cbStatus;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblCost;
    private javax.swing.JLabel lblCost1;
    private javax.swing.JLabel lblCost2;
    private javax.swing.JLabel lblCost3;
    private javax.swing.JLabel lblCost4;
    private javax.swing.JLabel lblCost5;
    private javax.swing.JLabel lblCost6;
    private javax.swing.JLabel lblCost7;
    private javax.swing.JLabel lblSearch;
    private javax.swing.JLabel lblTextName;
    private javax.swing.JLabel lblTextName1;
    private javax.swing.JPanel pnlProfile;
    private javax.swing.JPanel pnlSearch;
    private javax.swing.JTable tblStaffView;
    private javax.swing.JTextField txtAddress;
    private javax.swing.JTextField txtDOB;
    private javax.swing.JTextField txtDOJ;
    private javax.swing.JTextField txtDept;
    private javax.swing.JTextField txtEdu;
    private javax.swing.JTextField txtFName;
    private javax.swing.JTextField txtLName;
    private javax.swing.JTextField txtPhoneNo;
    private javax.swing.JTextField txtSearch;
    private javax.swing.JTextField txtTechSkill;
    // End of variables declaration//GEN-END:variables
}
